<#assign pageTitle = "${book.title!}" />
<#assign pageKeywords = pageTitle />
<#assign channelId = 9 />
<#assign pageHeader>
</#assign>
<#assign pageContent>
    <div class="body-wrap">
        <div class="content-wrap">
            <div class="crumbs pd-20">
                <i class="layui-icon layui-icon-home"></i>
                <a href="#" target="_blank">首页</a>
                <span class="sep">/</span>
                <a href="/book/index.html?categoryId=${book.categoryId}" target="_blank">${book.categoryName!}</a>
                <span class="sep">/</span>
                详情
            </div>
            <div class="book-info-wrap mb-20 clearfix">
                <div class="book-info-left">
                    <div class="book-info-header">
                        <div class="list-book-img">
                            <img src="${book.cover!}" alt="">
                        </div>
                        <div class="list-book-content">
                            <div class="list-course-title">${book.title!}</div>
                            <div class="list-book-info">
                                ${book.intro!}
                            </div>
                            <div class="list-book-price">
                                <#if book.price gt 0>
                                    ￥${book.price/100}
                                <#else>
                                    免费
                                </#if>
                            </div>
                            <div class="list-book-type">${book.categoryName!}</div>
                        </div>
                    </div>
                    <div class="wrap-title">
                        <div class="content-wrap">
                            <h3 class="fl">内容简介</h3>
                        </div>
                    </div>
                    <div class="book-info-body">
                        ${book.context!}
                    </div>
                </div>
                <div class="book-info-right">
                    <div class="download-wrap mb-20">
                        <#-- <a href="javascript:void(0)" onclick="bookBuy(${book.id})" class="download-btn"><i class="layui-icon layui-icon-cart"></i>购买</a>-->
                        <a href="javascript:void(0)" onclick="bookRequire(${book.id})" class="download-btn"><i class="layui-icon layui-icon-read"></i>样书申请</a>
                        <#if isFavorite?? && isFavorite?string == "true">
                            <a id="favorite-id" href="javascript:void(0)" onclick="deleteFavorite(${book.id},3,this)" class="layui-btn layui-btn-lg layui-btn-primary favorite-btn fr">
                                取消收藏
                            </a>
                        <#else>
                            <a id="favorite-id" href="javascript:void(0)" onclick="favorites(${book.id},3,this)" class="layui-btn layui-btn-lg layui-btn-primary favorite-btn fr">
                                收藏
                            </a>
                        </#if>
                    </div>
                    <div class="work-detail-info">
                        <ul class="details-wrap">
                            <li><span>主编：</span>
                                <#if teachers?? && teachers?size gt 0>
                                    <#list teachers as item>
                                        <span style="margin-right: 10px;">${item.name!} </span>
                                    </#list>
                                </#if>
                            </li>
                            <li><span>出版社：</span><span>${book.publisher!}</span></li>
                            <li><span>出版日期：</span><span>${book.publishDate!}</span></li>
                            <li><span>ISBN：</span><span>${book.isbn!}</span></li>
                            <li><span>定价：</span><span>${book.price/100} 元</span></li>
                            <li><span>装帧：</span><span>${book.binding!}</span></li>
                            <li><span>纸张：</span><span>${book.pages!}页</span></li>
                        </ul>
                    </div>
                    <#if bookList?? && bookList?size gt 0>
                        <div class="work-detail-info">
                            <div class="title">喜欢这本书的人也喜欢</div>
                            <div class="book-list-small mb-20">
                                <#list bookList as item>
                                    <div class="list-items">
                                        <div class="list-item">
                                            <div class="list-content">
                                                <a href="/book/view/${item.id}.html" target="_blank" class="list-book-img">
                                                    <img src="${item.cover!}" alt="">
                                                </a>
                                                <div class="list-book-content">
                                                    <a href="/book/view/${item.id}.html" target="_blank" class="list-book-title">${item.title!}</a>
                                                    <div class="list-book-info">${item.intro!}</div>
                                                    <div class="list-book-price">
                                                        <#if item.price gt 0>
                                                            ￥${item.price/100}
                                                        <#else>
                                                            免费
                                                        </#if>
                                                    </div>
                                                    <div class="list-book-type">${item.categoryName!}</div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </#list>

                            </div>
                        </div>
                    </#if>
                </div>
            </div>
        </div>
    </div>
</#assign>
<#assign pageFooter>
    <script type="text/javascript" src="/static/js/order.js"></script>
    <script type="text/javascript" src="/static/js/book/book-require.js?v=1"></script>
    <script type="text/javascript">
        var userId = ${userId}
        function bookBuy(bookId) {
            if (userId === 0) {
                return layer.msg("需要登录后方可操作，即将跳转到登录页面...", {time: 1500}, function () {
                    window.open("/auth/login.html");
                })
            }
            if(bookId < 1){
                return  layer.msg("参数异常", {icon: 2});
            }
            layer.open({
                title: '',
                type: 2,
                area: ['900px', '650px'],
                content: '/order/book.html?bookId=' + bookId
            });
        }
    </script>
</#assign>
<#include "../layouts/layout.ftl">